package org.jflame.commons.model;

/**
 * 默认的执行结果枚举. <br>
 * 200=执行成功 <br>
 * 400=提交的数据错误，即参数错误 <br>
 * 401=身份验证失败,如登录失败等 <br>
 * 403=无权限访问 <br>
 * 500=执行错误,通常是程序执行抛出异常了<br>
 * -1=执行失败,通常是无异常判定为操作失败
 */
public enum ResultEnum implements BaseResult {

    SUCCESS(200, "执行成功"),
    PARAM_ERROR(400, "提交的数据错误"),
    NO_AUTH(401, "身份验证失败"),
    FORBIDDEN(403, "无访问权限"),
    SERVER_ERROR(500, "服务器内部错误"),
    FAILED(-1, "执行失败");

    private int status;
    private String msg;

    private ResultEnum(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public int getStatus() {
        return status;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     * 返回结果描述.
     *
     * @return 结果描述String
     */
    public String getMessage() {
        return msg;
    }

}
